<?php 
    include("header.php");
?>

<?php
	if ( isset($_SESSION['user']) == true && isset($_GET['news_id'])  ) {
        $newsId = $_GET['news_id'];
    	$connect = mysql_connect(DB_SERVER, DB_USER, DB_PWD);
		mysql_select_db(DB_CATALOG);
	    $query = sprintf("DELETE FROM news_item WHERE news_id = %d", $newsId);
	    $result = mysql_query($query, $connect);
        $query = sprintf("DELETE FROM news_history WHERE news_id = %d", $newsId);
        $result = mysql_query($query, $connect);
    }

	redirect("/newsbox.php");
?>